package com.caosy.grassthinkremote.controller;

import com.caosy.grassthinkremote.common.RespData;
import com.caosy.grassthinkremote.entity.vo.CommodityReq;
import com.caosy.grassthinkremote.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @PostMapping("/addCommodityToCart")
    @ResponseBody
    public RespData addCommodityToCart(@RequestBody CommodityReq commodity, HttpServletRequest request) {
        return orderService.addCommodityToCart(commodity.getId(),request);
    }
}
